<div class="pageContent">
  <div class="panelBar">
		<ul class="toolBar">
			<li><a height="500" class="add" href="{:U('add?type='.$type)}" target="dialog" mask="true"><span>添加分类</span></a></li>
			<li><a class="delete" href="{:U('foreverdelete?id=')}{id}/navTabId/__MODULE__" target="ajaxTodo" title="你确定要删除此分类及其子分类吗？"><span>删除</span></a></li>
			<li><a height="500" class="edit" href="__URL__/edit/type/{$type}/cat_id/{id}" target="dialog" mask="true"><span>修改</span></a></li>
			<li class="line">line</li>
			<li><a class="icon" href="doc/dwz-team.xls" target="dwzExport" targetType="dialog" title="实要导出这些记录吗?"><span>导出EXCEL</span></a></li>
		</ul>
	</div>
<table width="100%" class="table" layoutH="50">
  <thead><tr align="center">
    <th align="left" style="padding-left: 10px;">分类名</th>
    <th>英文名</th>
    <th>数量</th>
    <th>导航栏</th>
    <th>是否显示</th>
    <th>排序</th>
    <th>操作</th>
  </tr></thead>
  <volist name="cat_info" id="cat">
  <tr align="center" class="{$cat.level}" id="{$cat.level}_{$cat.cat_id}" target="id" rel="{$cat.cat_id}">
    <td align="left" class="first-cell"  style="padding-left: 10px;">
      <if condition="$cat.is_leaf neq 1">
      <img src="/Public/Images/menu_minus.gif" id="icon_{$cat.level}_{$cat.cat_id}" width="9" height="9" border="0" style="margin-left:{$cat.level}em" onclick="rowClicked(this)" />
      <else />
      <img src="/Public/Images/menu_arrow.gif" width="9" height="9" border="0" style="margin-left:{$cat.level}em" />
      </if>
      <span>{$cat.cat_name}</span>
    </td>
    <td width="10%">
<span onclick="listTable.edit(this, '__URL__/setField/field/english_name/', {$cat.cat_id})">{$cat.english_name|default="无"}</span>
    </td>
    <td width="10%">{$cat.content_num}</td>

    <td width="10%">
<img src="/Public/Images/<if condition="$cat.show_in_nav eq '1'">yes<else/>no</if>.gif" onclick="listTable.toggle(this, '__URL__/setField/field/show_in_nav/', {$cat.cat_id})" />
</td>
    <td width="10%">
<img src="/Public/Images/<if condition="$cat.is_show eq '1'">yes<else/>no</if>.gif" onclick="listTable.toggle(this, '__URL__/setField/field/is_show/', {$cat.cat_id})" />
    </td>
    <td width="10%">
		<span onclick="listTable.edit(this, '__URL__/setField/field/sort_order/', {$cat.cat_id})">{$cat.sort_order|default="无"}</span>
    </td>
    <td width="24%">
      <a class="move" href="#"><span>转移数据</span></a>
	  <a height="500" class="edit" href="__URL__/edit/type/{$type}/cat_id/{$cat.cat_id}" target="dialog" mask="true"><span>修改</span></a>
	  <a class="delete" href="{:U('foreverdelete?id=')}{$cat.cat_id}/navTabId/__MODULE__" target="ajaxTodo" title="你确定要删除此分类及其子分类吗？"><span>删除</span></a>
    </td>
  </tr>
  </volist>
</table>
</div>
<script language="JavaScript" type="text/javascript" defer="defer">
<!--
var imgPlus = new Image();
imgPlus.src = "/Public/Images/menu_plus.gif";

/**
 * 折叠分类列表
 */
function rowClicked(obj){
  // 当前图像
  img = obj;
  // 取得上二级tr>td>img对象
  obj = obj.parentNode.parentNode.parentNode;
  // 整个分类列表表格
  //var tbl = document.getElementById("listTable").parentNode.parentNode; 
  var tbl = obj.parentNode;
  //document.getElementById("list-table");
/*  alert(tbl);
  alert(tbl.rows.length);return false;*/
  // 当前分类级别
  var lvl = parseInt(obj.className);
  // 是否找到元素
  var fnd = false;
  var sub_display = img.src.indexOf('menu_minus.gif') > 0 ? 'none' : ($.browser.msie) ? 'block' : 'table-row' ;
  // 遍历所有的分类
	  
  for (i = 0; i < tbl.rows.length; i++)
  {
      var row = tbl.rows[i];
      if (row == obj)
      {
          // 找到当前行
          fnd = true;
          //document.getElementById('result').innerHTML += 'Find row at ' + i +"<br/>";
      }else{
          if (fnd == true){
              var cur = parseInt(row.className);
              var icon = 'icon_' + row.id;
              if (cur > lvl){
                  row.style.display = sub_display;
                  if (sub_display != 'none'){
                      var iconimg = document.getElementById(icon);
                      iconimg.src = iconimg.src.replace('plus.gif', 'minus.gif');
                  }
              }else{
                  fnd = false;
                  break;
              }
          }
      }
  }
//alert(obj);
  for (i = 0; i < obj.cells[0].childNodes[0].childNodes.length; i++)
  {
      var imgObj = obj.cells[0].childNodes[0].childNodes[i];
      if (imgObj.tagName == "IMG" && imgObj.src != '/Public/Images/menu_arrow.gif')
      {
          imgObj.src = (imgObj.src == imgPlus.src) ? '/Public/Images/menu_minus.gif' : imgPlus.src;
      }
  }
}
//-->
</script>